#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author:余振新
@file: read_config.py
@time: 2023/03/30
"""

import configparser

from common.path import ensure_path_sep


class ReadIni:
    def __init__(self, filepath):
        self.config = configparser.ConfigParser()
        self.filepath = filepath

    def read_ini(self, section, option):
        self.config.read(ensure_path_sep(self.filepath), encoding="utf-8")
        return self.config.get(section, option)


if __name__ == '__main__':
    config = ReadIni("/config/config.ini")
    print(config.read_ini("ui", "url"))
